package thread;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

/**
 * 睡眠阻塞
 */
public class SleepDemo {
    public static void main(String[] args) throws IOException {
        //Scanner scan = new Scanner(System.in);
        BufferedReader br = new BufferedReader(
                new InputStreamReader(
                        System.in
                )
        );
        String line= br.readLine();
        int time = Integer.parseInt(line);

        System.out.println("请按秒输入倒计时时间");
        //int time = scan.nextInt();
        for (; time > 0; time--) {
            try {
                Thread.sleep(1000);//主线程执行时会阻塞1秒
                System.out.println(time + "秒");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println("时间到");

    }
}
